import Vue from 'vue';
import App from './App';
//引入路由
import router from '@/common/router'
import {
	RouterMount
} from 'uni-simple-router'

//引入vuex
import store from './store'
//把vuex定义成全局组件
Vue.prototype.$store = store

// 引入本地存储
import { CartModel } from './common/CartModel'
let cartmodel = new CartModel()
Vue.prototype.$cartmodel = cartmodel

// 弹出框
import DialogBox from './components/DialogBox/DialogBox';
// request请求
import api from './vmeitime-http'
Vue.prototype.$api = api
//全局图片+域名
Vue.prototype.$url = function join(data, type = ''){
	return data.map(item=>{
		if(!!type) return item[type] = 'http://localhost:3001' + item[type];
		else return item = 'http://localhost:3001' + item;
	})
}

Vue.config.productionTip = false

// 全局组件
Vue.component('DialogBox', DialogBox);
//mescroll
import MescrollBody from "@/components/mescroll-uni/mescroll-body.vue"
import MescrollUni from "@/components/mescroll-uni/mescroll-uni.vue"
Vue.component('mescroll-body', MescrollBody)
Vue.component('mescroll-uni', MescrollUni)

App.mpType = 'app'

const app = new Vue({
    ...App
})

//v1.3.5起 H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式
// #ifdef H5
	RouterMount(app,router,'#app')
// #endif

// #ifndef H5
	app.$mount(); //为了兼容小程序及app端必须这样写才有效果
// #endif
